import Example from '~/components/example'
import { TerminalInput } from '~/components/text/terminal'
import Link from '~/components/text/link'
import { Code } from '~/components/text/code'
import Quote from '~/components/text/quote'

export const meta = {
  editUrl: 'pages/docs/api/v1/api-docs-mdx/api-basics/authentication.mdx',
  lastEdited: '2019-08-15T13:57:53.000Z'
}

## Authentication

Provide your API token as part of the `Authorization` header.

To act on resources owned by a team add `teamId` query string at the end of an API URL and use the teamId as the value.

If the authentication is unsuccessful, the status code **403** is returned.

<Example>
  <Code>
    Authorization: Bearer{' '}
    {props.testingToken ? props.testingToken.token : '$TOKEN'}
  </Code>
  <Code>https://api.zeit.co/example?teamId=team_123</Code>
  <Quote>
    <b>Note:</b>{' '}
    {props.user
      ? "Since you're logged in, "
      : [
          'When ',
          <Link href="/login" key="loggedin">
            logged in
          </Link>,
          ','
        ]}{' '}
    the examples in the API will contain your secret token. Don't share them!
    For example, to get a{' '}
    <Link href="#endpoints/deployments/list-all-the-deployments">
      list of deployments
    </Link>{' '}
    try the following:
  </Quote>
  <TerminalInput>
    curl -H "Authorization: Bearer{' '}
    {props.testingToken ? props.testingToken.token : '$TOKEN'}"
    https://api.zeit.co/v2/now/deployments
  </TerminalInput>
</Example>
